//
//  FoodProfileScreen.m
//  ZooNgonDoiOS
//
//  Created by Trung sound on 6/6/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "FoodProfileScreen.h"
#import "FoodProfileViewController.h"

@implementation FoodProfileScreen

#define VIEW_BAR_HEIGHT 25
#define VIEW_CHECKIN_HEIGHT 48+VIEW_BAR_HEIGHT
#define VIEW_IMAGE_HEIGHT 198+VIEW_CHECKIN_HEIGHT
#define VIEW_TITLE_HEIGHT 81+VIEW_IMAGE_HEIGHT 
#define VIEW_PERSONLIKE_HEIGHT 65+VIEW_TITLE_HEIGHT
#define VIEW_REVIEW_HEIGHT 55+VIEW_PERSONLIKE_HEIGHT
#define VIEW_REVIEW1_HEIGHT 120+VIEW_REVIEW_HEIGHT
#define VIEW_REVIEW2_HEIGHT 120+VIEW_REVIEW1_HEIGHT
#define VIEW_REVIEW3_HEIGHT 120+VIEW_REVIEW2_HEIGHT
#define VIEW_READMORE_HEIGHT 28+VIEW_REVIEW3_HEIGHT

#define BTN_CHECKIN_WIDTH 95
#define BTN_CHECKIN_HEIGHT 38

@synthesize parent = _parent;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
    
        [self setContentSize:CGSizeMake(self.bounds.size.width, 900)];
        self.showsVerticalScrollIndicator = NO;
        _vBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, VIEW_BAR_HEIGHT)]; 
        _vBar.backgroundColor = [UIColor blackColor];
        
            // Draw view checkin
        _vCheckin = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_BAR_HEIGHT, self.bounds.size.width, 48)]; 
        _vCheckin.backgroundColor = [UIColor grayColor];
        
        _btnBackCheckin = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 50, 48)];
        _img_back_checkin = [UIImage imageNamed:IMG_BACK_CHECKIN];
        _btnBackCheckin.backgroundColor = [UIColor colorWithPatternImage:_img_back_checkin];
        [_vCheckin addSubview:_btnBackCheckin];
        
        _btnCheckin = [[UIButton alloc]initWithFrame:CGRectMake(self.bounds.size.width - BTN_CHECKIN_WIDTH -5, 5, BTN_CHECKIN_WIDTH, BTN_CHECKIN_HEIGHT)];
        [_btnCheckin addTarget:self action:@selector(btnLoginClicked) forControlEvents:UIControlEventTouchUpInside];
        _img_checkin = [UIImage imageNamed:IMG_CHECKIN];
        _btnCheckin.backgroundColor = [UIColor colorWithPatternImage:_img_checkin];
        [_vCheckin addSubview:_btnCheckin];
        
            // Draw view image
        _vImage = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_CHECKIN_HEIGHT, self.bounds.size.width, 198)]; 
        _img_Image_View = [UIImage imageNamed:IMG_IMAGEVIEW];
        _vImage.backgroundColor = [UIColor colorWithPatternImage:_img_Image_View];
        
            // Draw view title
        _vTitle = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_IMAGE_HEIGHT, self.bounds.size.width, 81)]; 
        _vTitle.backgroundColor = [UIColor cyanColor];
        
            // Draw view Person like
        _vPersonLike = [[PersonLikeScreen alloc]initWithFrame:CGRectMake(0, VIEW_TITLE_HEIGHT, self.bounds.size.width, 65)];
        
            // Draw view Review
        _vReview = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_PERSONLIKE_HEIGHT, self.bounds.size.width, 55)];
        _img_review = [UIImage imageNamed:IMG_REVIEW];
        _vReview.backgroundColor = [UIColor colorWithPatternImage:_img_review];
        
        _vReview1 = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_REVIEW_HEIGHT, self.bounds.size.width, 120)];
        _vReview1.backgroundColor = [UIColor lightGrayColor];
        
        _vReview2 = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_REVIEW1_HEIGHT, self.bounds.size.width, 120)];
        _vReview2.backgroundColor = [UIColor grayColor];
        
        _vReview3 = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_REVIEW2_HEIGHT, self.bounds.size.width, 120)];
        _vReview3.backgroundColor = [UIColor lightGrayColor];
        
        _vReadmore = [[UIView alloc]initWithFrame:CGRectMake(0, VIEW_REVIEW3_HEIGHT, self.bounds.size.width, 28)];
        _vReadmore.backgroundColor = [UIColor grayColor];
        
        _btnFeedback = [[UIButton alloc]initWithFrame:CGRectMake(0, VIEW_READMORE_HEIGHT, self.bounds.size.width, 41)];
        _img_feedback = [UIImage imageNamed:IMG_FEEDBACK];
        _btnFeedback.backgroundColor = [UIColor colorWithPatternImage:_img_feedback];
        [_btnFeedback addTarget:self action:@selector(btnFeedbackClicked) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview:_vBar];
        [self addSubview:_vCheckin];
        [self addSubview:_vImage];
        [self addSubview:_vTitle];
        [self addSubview:_vPersonLike];
        [self addSubview:_vReview];
        [self addSubview:_vReview1];
        [self addSubview:_vReview2];
        [self addSubview:_vReview3];   
        [self addSubview:_vReadmore];
        [self addSubview:_btnFeedback];

    }
    return self;
}


#pragma mark - Control button cliked
- (void) btnLoginClicked {
    FoodProfileViewController *foodProfileViewController = (FoodProfileViewController *)_parent;
    [foodProfileViewController switchToFeedBackScreen];
}

- (void) btnFeedbackClicked {
    
    
}

@end
